<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport"/>
    <meta name="apple-touch-fullscreen" content="yes"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta http-equiv="Cache-Control" content="no-cache"/>
    <link rel="stylesheet" href="/Public/Home/css/style.css" type="text/css">
    <title>问券调查</title>
    <script type="text/javascript" src="/Public/Home/js/js.js"></script>
    <script type="text/javascript" src="/Public/Home/js/jquery-1.11.1.min.js"></script>
</head>
<body>
<form action="/index.php/Home/Index/index/getData" method="post" id="sub_form">
<input type="hidden" name="sid" value="<?php echo ($result["sid"]); ?>">
<h1 class="title"><?php echo ($result["name"]); ?></h1>
<p class="wqbz"><?php echo ($result["desc"]); ?></p>
<?php if(is_array($result["quest"])): foreach($result["quest"] as $key=>$vo): ?><div class="wenti">
        <p class="went_p">
            <?php if($vo["isrequired"] == 1): ?><span>*</span><?php endif; ?>
            <?php echo ($vo["questno"]); ?>.<?php echo ($vo["question"]); ?>
        </p>
        <p class="went_b"><?php echo ($vo["description"]); ?></p>
        <?php if($vo["questiontype"] == 1): if(is_array($vo["options"])): foreach($vo["options"] as $key=>$lo): ?><p class="da">
                      <span class="radio">
                          <?php if($lo["optionno"] == 0): ?><input id="radio<?php echo ($vo["questno"]); ?>_<?php echo ($lo["optionno"]); ?>" type="radio" name="<?php echo ($vo["questionid"]); ?>"
                                   value="<?php echo ($lo["optionno"]); ?>" checked/>
                          <?php else: ?>
                            <input id="radio<?php echo ($vo["questno"]); ?>_<?php echo ($lo["optionno"]); ?>" type="radio" name="<?php echo ($vo["questionid"]); ?>"
                                   value="<?php echo ($lo["optionno"]); ?>"/><?php endif; ?>
                              <label for="radio<?php echo ($vo["questno"]); ?>_<?php echo ($lo["optionno"]); ?>"></label>
                      </span>
                    <span class="xuanx"><?php echo ($lo["optioncontent"]); ?></span>
                </p><?php endforeach; endif; ?>
            <?php elseif($vo["questiontype"] == 2): ?>
            <?php if(is_array($vo["options"])): foreach($vo["options"] as $key=>$lo): ?><p class="da">
                  <span class="checkbox">
                      <input id="checkbox_<?php echo ($vo["questno"]); ?>_<?php echo ($lo["optionno"]); ?>" type="checkbox" name="<?php echo ($vo["questionid"]); ?>[]"
                             value="<?php echo ($lo["optionno"]); ?>"/>
                      <label for="checkbox_<?php echo ($vo["questno"]); ?>_<?php echo ($lo["optionno"]); ?>"></label>
                  </span>
                    <span class="xuanx"><?php echo ($lo["optioncontent"]); ?></span>
                </p><?php endforeach; endif; ?>
            <?php elseif($vo["questiontype"] == 3): ?>
            <p class="da">
                <select name="<?php echo ($vo["questionid"]); ?>">
                    <option value="0">请选择</option>
                    <?php if(is_array($vo["options"])): foreach($vo["options"] as $key=>$lo): ?><option value="<?php echo ($lo["optionno"]); ?>"><?php echo ($lo["optioncontent"]); ?></option><?php endforeach; endif; ?>
                </select>
            </p>
            <?php elseif($vo["questiontype"] == 4): ?>
            <p class="da">
                <input type="text" name="<?php echo ($vo["questionid"]); ?>" class="da_an"/>
            </p>
            <?php else: ?>
            <p class="da">
                <textarea name="<?php echo ($vo["questionid"]); ?>"></textarea>
            </p><?php endif; ?>
    </div><?php endforeach; endif; ?>
<p class="iphone">
    <span>*</span>手机号： <input type="text" id="iphone" name="iphone" placeholder="请输入手机号"/>
</p>
<p><button class="tijiao" onclick="sub();return false;">提交</button></p>
</form>
<script>
    function sub() {
        var iphone = $("#iphone").val();
        var pattern = /^1[34578]\d{9}$/;
        if(!pattern.test(iphone)){
            alert('手机号码格式不正确！');
        }else{
            $('#sub_form').submit();
        }
    }
    var id = '<?php echo ($result["sid"]); ?>';

    $.post("/index.php/Home/Index/index/updateAccess",{id:id},function(result){
        console.log(result);
    },"json");
</script>
</body>
</html>